#-*- coding:utf-8 -*-
from PIL import Image
import xlsxwriter

img = Image.open("1.jpg")

w, h = img.size

work = xlsxwriter.Workbook('h.xlsx')

worksheet = work.add_worksheet()

worksheet.set_default_row(1)
worksheet.set_column(0, w - 1, 1)

# for r in range(h):
#     for c in range(w):
#         color = img.getpixel((c, r))[:3]  # Extract RGB values
#         # print(img.getpixel((c,r)))
#         style = work.add_format({'bg_color': '#%02x%02x%02x' % tuple(map(int, color))})
#         worksheet.write(r, c, '', style)

# work.close()